package io.renren.modules.courseTest.controller;

import io.renren.modules.courseTest.service.courseTestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@RestController
@RequestMapping("api/courseTestUpload")
public class uploadCourseTest {

    @Autowired
    courseTestService courseTestService;

    @RequestMapping(value="/upload",method = RequestMethod.POST)
    @ResponseBody
    public List upload(@RequestParam(value="file",required = false) MultipartFile file, HttpServletRequest request, HttpServletResponse response){
        List<String[]> result = courseTestService.readExcelFile(file);
        System.out.println(result.get(0)[0]);
        return result;
    }
}
